Demand-Driven Type Inference with Subgoal Pruning: Trading Precision for Scalability

نویسندگان

  • S. Alexander Spoon
  • Olin Shivers
چکیده

After two decades of effort, type inference for dynamically typed languages scales to programs of a few tens of thousands of lines of code, but no further. For larger programs, this paper proposes using a kind of demand-driven analysis where the number of active goals is carefully restricted. To achieve this restriction, the algorithm occasionally prunes goals by giving them solutions that are trivially true and thus require no further subgoals to be solved; the previous subgoals of a newly pruned goal may often be discarded from consideration, reducing the total number of active goals. A specific algorithm DDP is described which uses this approach. An experiment on DDP shows that it infers precise types for roughly 30% to 45% of the variables in a program with hundreds of thousands of lines; the percentage varies with the choice of pruning threshold, a parameter of the algorithm. The time required varies from an average of one-tenth of one second per variable to an unknown maximum, again depending on the pruning threshold. These data suggest that 50 and 2000 are both good choices of pruning threshold, depending on whether speed or precision is more important.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Demand-driven Alias Analysis Implementation Based on Open64

In this paper, an implementation of a demand-driven alias analysis [7] in Open64 is presented. In the algorithm, a program expression graph is constructed based on all the expressions and assignments in the program, and the memory alias problem is formulated as a CFL-reachability problem. To deal with field accesses of structs which are common in multi-media applications, a field-sensitive exte...

متن کامل

Demand-Driven Data Flow Analysis for Communication Optimization

Exhaustive global array data flow analysis for communication optimization is expensive and considered to be impractical for large programs. This paper proposes a demand-driven analysis approach that reduces the analysis cost by computing only the data flow information related to optimizations. In addition, the analysis cost of our scheme can be effectively managed by trading space for time or c...

متن کامل

Leveraging Ontologies for Lifted Probabilistic Inference and Learning

Exploiting ontologies for efficient inference is one of the most widely studied topics in knowledge representation and reasoning. The use of ontologies for probabilistic inference, however, is much less developed. A number of algorithms for lifted inference in first-order probabilistic languages have been proposed, but their scalability is limited by the combinatorial explosion in the sets of o...

متن کامل

Scalable, Ow-sensitive Type Inference for Statically Typed Object-oriented Languages

An important problem in the analysis of programs written in object-oriented languages like C++/Java is to determine the values that a pointer variable ( a reference to an object in Java ) can have at run-time. This information can be used for applications such as virtual function resolution, side-e ect analysis, detecting memory errors etc. We address issues involved in designing a scalable, ow...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2004